<form name="shareForm" ng-submit="$modal.save()" novalidate>
    <div class="modal-header bg-primary">
        <h3 class="modal-title">Share case</h3>
    </div>
    <div class="modal-body">

        <p>
            Select the organisations you would like to share the case with.
        </p>

        <div class="form-group" ng-class="{ 'has-error' : shareForm.organisations.$invalid && !shareForm.organisations.$pristine }">
            <label>
                Organisation
                <i class="fa fa-asterisk text-danger"></i>
            </label>
            <select class="form-control" name="organisations" ng-model="$modal.formData.organisations"
                ng-options="organisation for organisation in $modal.organisations" multiple size="10" required>
            </select>
            <p class="help-block" ng-show="shareForm.organisations.$invalid && !shareForm.organisations.$pristine">This field is required.</p>
        </div>

        <div class="form-group" ng-class="{ 'has-error' : shareForm.profile.$invalid && !shareForm.profile.$pristine }">
            <label>
                Profile
                <i class="fa fa-asterisk text-danger"></i>
            </label>
            <select class="form-control" name="profile" ng-model="$modal.formData.profile" ng-options="profile for profile in $modal.profiles" required>
                    <option value="" disabled selected>-- Select profile --</option>
            </select>
            <p class="help-block" ng-show="shareForm.profile.$invalid && !shareForm.profile.$pristine">This field is required.</p>
        </div>

        <div class="form-group">
            <label>
                Tasks
                <i class="fa fa-asterisk text-danger"></i>
            </label>
            <select class="form-control" name="tasks" ng-model="$modal.formData.tasks"
                ng-options="item for item in $modal.options">
            </select>
        </div>

        <div class="form-group">
            <label>
                Observables
                <i class="fa fa-asterisk text-danger"></i>
            </label>
            <select class="form-control" name="observables" ng-model="$modal.formData.observables"
                ng-options="item for item in $modal.options">
            </select>
        </div>

    </div>
    <div class="modal-footer">
        <button class="btn btn-default pull-left" type="button" ng-click="$modal.cancel()">Cancel</button>
        <button class="btn btn-primary pull-right" type="submit" ng-disabled="shareForm.$invalid">Save</button>
    </div>
</form>
